<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sinox="http://www.sinosoft.com.cn/sinox"
	xmlns:p="http://primefaces.org/ui">
	
	<ui:param name="compBean1Id" value="createPrivilegesSource" />
	<ui:param name="compBean2Id" value="createPrivilegesTarget" />
	
	<table cellspacing="5" style="width:100%;">
	<tbody>
	<tr>
		<td style="width:35%">
			<p:dataTable id="#{compBean1Id}" var="ps" value="#{commonContentViewBean.createPrivilegeModel.source}"
		        emptyMessage="没有权限" selectionMode="multiple" rowIndexVar="psvar"
		        selection="#{commonContentViewBean.createPrivilegeModel.selectedSources}">
		  		
		  		<p:column headerText="序号" style="width:20px;">
		  			<h:outputText value="#{psvar + 1}"/>
				</p:column>
				
				<p:column headerText="权限名称">
					<h:outputText value="#{ps.name}" />
				</p:column>
		    </p:dataTable>
		</td>
		<td style="width:10%">
			<table cellspacing="5" style="width:100%;text-align:center;">
			<tbody>
			<tr><td>
				<p:commandButton title="选择全部" 
					actionListener="#{bpmAction.definePrivilegeAction}"
					image="ui-icon ui-icon-arrowstop-1-e"
					update="#{compBean1Id},#{compBean2Id}">
					<h:inputHidden value="#{commonContentViewBean.id}" />
					<h:inputHidden value="addAll" />
					<h:inputHidden value="create" />
				</p:commandButton>
			</td></tr>
			<tr><td>
				<p:commandButton title="选择" 
					actionListener="#{bpmAction.definePrivilegeAction}"
					image="ui-icon ui-icon-arrow-1-e"
					update="#{compBean1Id},#{compBean2Id}">
					<h:inputHidden value="#{commonContentViewBean.id}" />
					<h:inputHidden value="add" />
					<h:inputHidden value="create" />
				</p:commandButton>
			</td></tr>
			<tr><td>
				<p:commandButton title="移除" 
					actionListener="#{bpmAction.definePrivilegeAction}"
					image="ui-icon ui-icon-arrow-1-w"
					update="#{compBean1Id},#{compBean2Id}">
					<h:inputHidden value="#{commonContentViewBean.id}" />
					<h:inputHidden value="remove" />
					<h:inputHidden value="create" />
				</p:commandButton>
			</td></tr>
			<tr><td>
				<p:commandButton title="移除全部" 
					actionListener="#{bpmAction.definePrivilegeAction}"
					image="ui-icon ui-icon-arrowstop-1-w"
					update="#{compBean1Id},#{compBean2Id}">
					<h:inputHidden value="#{commonContentViewBean.id}" />
					<h:inputHidden value="removeAll" />
					<h:inputHidden value="create" />
				</p:commandButton>
			</td></tr>
			</tbody>
			</table>
		</td>
		<td style="width:55%">
			<p:dataTable id="#{compBean2Id}" var="pt" value="#{commonContentViewBean.createPrivilegeModel.target}"
		        emptyMessage="没有权限" selectionMode="multiple" rowIndexVar="ptvar"
		        selection="#{commonContentViewBean.createPrivilegeModel.selectedTargets}">
		  		
		  		<p:column headerText="序号" style="width:20px;">
		  			<p:cellEditor>  
		                <f:facet name="output">  
		                    <h:outputText value="#{ptvar + 1}"/>
		                </f:facet>  
		                <f:facet name="input">
							<h:outputText value="#{ptvar + 1}"/>
		                </f:facet>
		            </p:cellEditor>
				</p:column>
				
				<p:column headerText="权限名称" style="width:50px;">
					<p:cellEditor>  
		                <f:facet name="output">  
		                    <h:outputText value="#{pt.name}" />
		                </f:facet>  
		                <f:facet name="input">
		                	<h:outputText value="#{pt.name}" />
		                </f:facet>
		            </p:cellEditor>
				</p:column>
				
				<p:column headerText="权限类别" style="width:50px;">
					<p:cellEditor>  
		                <f:facet name="output">  
		                    <h:outputText value="#{roleSelectItemsService.itemsMap[pt.type]}" />
		                </f:facet>  
		                <f:facet name="input">  
		                    <sinox:selectOneMenu value="#{pt.type}"
								items="#{roleSelectItemsService.items}" width="150" />
		                </f:facet>
		            </p:cellEditor>
				</p:column>
		  		
		  		<p:column headerText="编辑" style="width:20px;">  
		            <p:rowEditor />  
		        </p:column>
		    </p:dataTable>
		</td>
		
	</tr>
	</tbody>
	</table>
	
</ui:composition>